package stream.basic_data;

import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Properties;

/**
 * @CreateBy zhangdingyi
 * @Date 2022-10-25
 * @Content 操作文件
 */
public class DoFiles {
    public static void main(String[] args) {
        firstDoPath();
    }
    /**
     * 操作文件还有一些内容
     * 读写文件
     * 移动文件
     * 获取文件信息
     * 访问目录
     * 目录流
     * zip文件系统
     * 内存映射文件
     * 正则表达式等
     * -后面有时间再看看
     */

    /**
     * 操作 路径
     * 感觉没啥用
     * 只有读取 全路径的时候才觉得有点用
     */
    static void firstDoPath() {

       /* 正常的跑 --可能是跟据项目为准，得到的都是相对路径
        Path path = Paths.get("emp.txt");
        System.out.println("path = " + path);

        Path resolve = path.resolve(path);
        System.out.println("resolve = " + resolve);

        Path parent = path.getParent();
        System.out.println("parent = " + parent);
        Path fileName = path.getFileName();
        System.out.println("fileName = " + fileName);
        Path root = path.getRoot();
        System.out.println("root = " + root);*/
        //"D:\\working_space\\java_core_technology_volume\\CoreTechnologyVolume\\src\\stream\\basic_data\\IOSteam.java"
        Path path = Paths.get("src/stream/basic_data/IOSteam.java");
        System.out.println("path = " + path);

        Path resolve = path.resolve("D:\\working_space\\java_core_technology_volume\\CoreTechnologyVolume\\src\\stream\\basic_data\\IOSteam.java");
        System.out.println("resolve = " + resolve);

        Path parent = path.getParent();
        System.out.println("parent = " + parent);
        Path fileName = path.getFileName();
        System.out.println("fileName = " + fileName);

        //这个挺好，如果是相对路径的话，可以用这个来判断该 数据是否为相对路径
        Path root = path.getRoot();
        System.out.println("root = " + root);

    }

}
